<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            border: 1px solid #000;
        }

        #btn {
            width: 50px;
            height: 20px;
            line-height: 20px;
            text-align: center;
        }
    </style>
</head>

<body>
    <div>
        <pre>
        &lt;script type="text/javascript">
            var i = iResult = 0;
            function sum()
            {
               for (var i = 0; i < arguments.length; i++)
               {
                  iResult += arguments[i];
               }
                return iResult;
            }
            //应用
            alert(sum(1,2,3,4,5,6,7,8,9,10));  //输出55
        &lt;/script>
        </pre>
        <button id="btn">结果</button>
    </div>
</body>

</html>
<script>
    var btn = document.querySelector('#btn')
    var a = 0
    var n = 6
    for (var i = 0; i < btn.innerHTML.length; i++) {
        btn.onclick = function () {
            console.log(1);
            this.innerHTML = a = a + n
        }
    }
</script>